package cn.wzvtcsoft.sys.entity;

import cn.wzvtcsoft.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Objects;
import java.util.Set;
@Setter
@Getter
@Entity(name = "sys_role")
public class Role extends BaseEntity {

  private String roleName;

  private String remark;

  @OneToMany(mappedBy = "role", cascade = CascadeType.REMOVE, orphanRemoval = true)
  @JsonIgnore
  private Set<UserRole> userRoles;

  @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true)
  private Set<RolePermission> rolePermissions;

}
